const mysql = require("mysql")
let connection = mysql.createConnection({
    host: "127.0.0.1",
    port: 3306,
    database: "stu",
    user: "root",
    password: "123456"
})
// 连接数据库
connection.connect()

function Query (sql) {
    return new Promise((reslove, reject) => {
        connection.query(sql, (err, result) => {
            reslove([err, result])
        })
    })
}
module.exports = Query